<template>
    <van-nav-bar title="公告详情 " left-text="返回" left-arrow @click-left="onClickLeft" />

    <div class="box">
        <h3>标题：{{ title }}</h3><hr>
        <p>内容：{{ content }}</p>
    </div>
</template>
    
<script setup lang='ts'>
import { ref, onUnmounted, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { getNoticeDetail } from '../api/api';
import $bus from "../config/eventBus";
//  刷新
let loadingTag = ref<boolean>(true);
// 获取传递的 通知的 id 值
const router = useRouter();
// 可以使用 route 来获取 参数值
const route = useRoute();
const title = ref('')
const content = ref('')
onMounted(async () => {

    const ret2 = await getNoticeDetail(route.query.params as string);
    console.log("1", ret2)
    if (ret2.data.code === 0) {
        title.value = ret2.data.data.noticeName
        content.value = ret2.data.data.noticeContent
        // console.log("2", title.value)
    } else {
        return false
    }

});

//  返回上一页
const onClickLeft = () => history.back();
//登陆页不要tabBar
onMounted(() => {
    $bus.emit("tabBarHide", false);
})

//页面离开记得销毁
onUnmounted(() => {
    $bus.emit("tabBarHide", true);
})
</script>
    
<style scoped lang='scss'>
.box{
    margin: 15px;
    
}

</style>